<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php
	$key= (isset($key))? $key:lang('ranking.sample_text_input_search');
?>
<!-- Search area -->
<form action="<?php echo site_url('ranking/search/')?>" method="get" name="search" id="search" >
	<div class="wrap-content border" style="border-bottom:0;">
		<section id="search-area">
			<input style="cursor: pointer;" onclick="javascript:search_data('region');" type="button" class="black-button" value="<?php echo lang('ranking.search_by_region');?>" />

			<div id="region_"><?php echo $regions ?></div>
			<div id="city_"><?php echo $cities ?></div>

			<input onclick="javascript:search_data('key');" style="cursor: pointer;" type="button" class="black-button" value="<?php echo lang('ranking.search_by_keyword');?>" style="padding:0 17px;" />

			<input type="text" class="text-input" name="key" id="key" value="<?php echo $key;?>" />

			<input type="button" class="green-button" value="<?php echo lang('ranking.search');?>" style="margin:14px 10px" onclick="javascript:search_data('all');" />
			<p>※　検索結果はランキングの中で赤い枠で囲まれます。</p>
		</section>
		<input type="hidden" name="by" id="by" value="" />
	</div>
	<div class="clrboth"></div>
	<!-- end search area -->
</form>

<script type="text/javascript">
	function search_data(type){
		switch(type){
			case 'region':
				$('#key').val('');
				break;
			case 'key':
				$('#region option[value=0]').attr('selected', 'selected');
				$('#city option[value=0]').attr('selected', 'selected');
				break;
		}
		$('#by').val(type);
		jQuery('#search').submit();
	}
</script>